/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.farmcode.web.generator.template;

import com.farmcode.api.runtime.regex.Match;
import com.farmcode.base.web.BaseBacking;
import com.farmcode.console.api.business.custom.ExtTemplateManager;
import com.farmcode.console.api.model.Template;
import com.farmcode.web.generator.match.MatchContextPopup;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.enterprise.context.RequestScoped;

/**
 *
 * @author Oscar Ivan Prado
 */
@Named(value = "templateBackingBean")
@RequestScoped
public class TemplateBackingBean extends BaseBacking{

    @EJB
    private ExtTemplateManager extTemplateManager;
    
    /** Creates a new instance of TemplateBackingBean */
    public TemplateBackingBean() {
    }
    
    public void onTemplateSelected(Template template){
        getSession().setValue(new Match().getClass().getCanonicalName(), new Match());
        getSession().setValue(new Template().getClass().getCanonicalName(), template);
        getSession().setValue("templateId", template.getId());
        openLookUp(MatchContextPopup.class);
    }
    
   
}
